package Phase2Tests;
import org.junit.Assert;

import Phase2.*;

public class CheckHyperWeb
{
	public static void threeNodes(Node[] nodeList) throws InterruptedException
	{
		boolean rootAccess = false;
		Node assertNode = nodeList[0];
		int[] up = {};
		int[] down = {};
		int[] neighbour = {1, 2};
		Assert.assertArrayEquals(up, assertNode.getUpPointers(rootAccess).idToArray());
		Assert.assertArrayEquals(down, assertNode.getDownPointers(rootAccess).idToArray());
		Assert.assertArrayEquals(neighbour, assertNode.getNeighbours(rootAccess).idToArray());
		Assert.assertEquals(1, assertNode.getFold(rootAccess).getId(rootAccess));
		Assert.assertEquals(null, assertNode.getOldFold());
		Assert.assertEquals("EmptyState", assertNode.getState(rootAccess).toString());
		
		assertNode = nodeList[1];
		int[] up1 = {2};
		int[] down1 = {};
		int[] neighbour1 = {0};
		Assert.assertArrayEquals(up1, assertNode.getUpPointers(rootAccess).idToArray());
		Assert.assertArrayEquals(down1, assertNode.getDownPointers(rootAccess).idToArray());
		Assert.assertArrayEquals(neighbour1, assertNode.getNeighbours(rootAccess).idToArray());
		Assert.assertEquals(2, assertNode.getFold(rootAccess).getId(rootAccess));
		Assert.assertEquals(0, assertNode.getOldFold().getId(rootAccess));
		Assert.assertEquals("UpState", assertNode.getState(rootAccess).toString());
		
		assertNode = nodeList[2];
		int[] up2 = {};
		int[] down2 = {1};
		int[] neighbour2 = {0};
		Assert.assertArrayEquals(up2, assertNode.getUpPointers(rootAccess).idToArray());
		Assert.assertArrayEquals(down2, assertNode.getDownPointers(rootAccess).idToArray());
		Assert.assertArrayEquals(neighbour2, assertNode.getNeighbours(rootAccess).idToArray());
		Assert.assertEquals(1, assertNode.getFold(rootAccess).getId(rootAccess));
		Assert.assertEquals(null, assertNode.getOldFold());
		Assert.assertEquals("DownState", assertNode.getState(rootAccess).toString());
	}
	
	public static void fourNodes(Node[] nodeList) throws InterruptedException
	{
		boolean rootAccess = false;
		Node assertNode = nodeList[0];
		int[] up = {};
		int[] down = {};
		int[] neighbour = {1, 2};
		Assert.assertArrayEquals(up, assertNode.getUpPointers(rootAccess).idToArray());
		Assert.assertArrayEquals(down, assertNode.getDownPointers(rootAccess).idToArray());
		Assert.assertArrayEquals(neighbour, assertNode.getNeighbours(rootAccess).idToArray());
		Assert.assertEquals(3, assertNode.getFold(rootAccess).getId(rootAccess));
		Assert.assertEquals(null, assertNode.getOldFold());
		Assert.assertEquals("EmptyState", assertNode.getState(rootAccess).toString());
		
		assertNode = nodeList[1];
		int[] up1 = {};
		int[] down1 = {};
		int[] neighbour1 = {0, 3};
		Assert.assertArrayEquals(up1, assertNode.getUpPointers(rootAccess).idToArray());
		Assert.assertArrayEquals(down1, assertNode.getDownPointers(rootAccess).idToArray());
		Assert.assertArrayEquals(neighbour1, assertNode.getNeighbours(rootAccess).idToArray());
		Assert.assertEquals(2, assertNode.getFold(rootAccess).getId(rootAccess));
		Assert.assertEquals(null, assertNode.getOldFold());
		Assert.assertEquals("EmptyState", assertNode.getState(rootAccess).toString());
		
		assertNode = nodeList[2];
		int[] up2 = {};
		int[] down2 = {};
		int[] neighbour2 = {0, 3};
		Assert.assertArrayEquals(up2, assertNode.getUpPointers(rootAccess).idToArray());
		Assert.assertArrayEquals(down2, assertNode.getDownPointers(rootAccess).idToArray());
		Assert.assertArrayEquals(neighbour2, assertNode.getNeighbours(rootAccess).idToArray());
		Assert.assertEquals(1, assertNode.getFold(rootAccess).getId(rootAccess));
		Assert.assertEquals(null, assertNode.getOldFold());
		Assert.assertEquals("EmptyState", assertNode.getState(rootAccess).toString());
		
		assertNode = nodeList[3];
		int[] up3 = {};
		int[] down3 = {};
		int[] neighbour3 = {1, 2};
		Assert.assertArrayEquals(up3, assertNode.getUpPointers(rootAccess).idToArray());
		Assert.assertArrayEquals(down3, assertNode.getDownPointers(rootAccess).idToArray());
		Assert.assertArrayEquals(neighbour3, assertNode.getNeighbours(rootAccess).idToArray());
		Assert.assertEquals(0, assertNode.getFold(rootAccess).getId(rootAccess));
		Assert.assertEquals(null, assertNode.getOldFold());
		Assert.assertEquals("LastState", assertNode.getState(rootAccess).toString());
	}
	/*
	public static void fiveNodes(Node[] nodeList)
	{
		Node assertNode = nodeList[0];
		int[] up = {};
		int[] down = {};
		int[] neighbour = {1, 2, 4};
		Assert.assertArrayEquals(up, assertNode.getUpPointers().idToArray());
		Assert.assertArrayEquals(down, assertNode.getDownPointers(rootAccess).idToArray());
		Assert.assertArrayEquals(neighbour, assertNode.getNeighbours().idToArray());
		Assert.assertEquals(3, assertNode.getFold().getId());
		Assert.assertEquals(null, assertNode.getOldFold());
		Assert.assertEquals("EmptyState", assertNode.getState().toString());
		
		assertNode = nodeList[1];
		up = new int[] {4};
		down = new int[]{};
		neighbour = new int[]{0, 3};
		Assert.assertArrayEquals(up, assertNode.getUpPointers().idToArray());
		Assert.assertArrayEquals(down, assertNode.getDownPointers(rootAccess).idToArray());
		Assert.assertArrayEquals(neighbour, assertNode.getNeighbours().idToArray());
		Assert.assertEquals(2, assertNode.getFold().getId());
		Assert.assertEquals(null, assertNode.getOldFold());
		Assert.assertEquals("UpState", assertNode.getState().toString());
		
		assertNode = nodeList[2];
		int[] up2 = {4};
		int[] down2 = {};
		int[] neighbour2 = {0, 3};
		Assert.assertArrayEquals(up2, assertNode.getUpPointers().idToArray());
		Assert.assertArrayEquals(down2, assertNode.getDownPointers(rootAccess).idToArray());
		Assert.assertArrayEquals(neighbour2, assertNode.getNeighbours().idToArray());
		Assert.assertEquals(1, assertNode.getFold().getId());
		Assert.assertEquals(null, assertNode.getOldFold());
		Assert.assertEquals("UpState", assertNode.getState().toString());
		
		assertNode = nodeList[3];
		int[] up3 = {};
		int[] down3 = {};
		int[] neighbour3 = {1, 2};
		Assert.assertArrayEquals(up3, assertNode.getUpPointers().idToArray());
		Assert.assertArrayEquals(down3, assertNode.getDownPointers(rootAccess).idToArray());
		Assert.assertArrayEquals(neighbour3, assertNode.getNeighbours().idToArray());
		Assert.assertEquals(4, assertNode.getFold().getId());
		Assert.assertEquals(0, assertNode.getOldFold());
		Assert.assertEquals("LastState", assertNode.getState().toString());
		
		assertNode = nodeList[4];
		int[] up4 = {};
		int[] down4 = {1, 2};
		int[] neighbour4 = {0};
		Assert.assertArrayEquals(up4, assertNode.getUpPointers().idToArray());
		Assert.assertArrayEquals(down4, assertNode.getDownPointers(rootAccess).idToArray());
		Assert.assertArrayEquals(neighbour4, assertNode.getNeighbours().idToArray());
		Assert.assertEquals(3, assertNode.getFold().getId());
		Assert.assertEquals(null, assertNode.getOldFold());
		Assert.assertEquals("DownState", assertNode.getState().toString());
	}*/
}
